// *Author：jxx
// *Contact：283591387@qq.com
// *代码由框架生成,任何更改都可能导致被代码生成器覆盖
export default function(){
    const table = {
        key: 'Id',
        footer: "Foots",
        cnName: '质检方案',
        name: 'PlanInfo',
        url: "/PlanInfo/",
        sortName: "Id"
    };
    const tableName = table.name;
    const tableCNName = table.cnName;
    const newTabEdit = false;
    const key = table.key;
    const editFormFields = {"PlanNo":"","PlanName":"","BusinessType":[],"IsEnabled":"","Remarks":"","autoCreate":0};
    const editFormOptions = [
        [
            {
                "title":"方案编号",
                "field":"PlanNo",
                "type":"text",
                "required": true,
                "colSize": 8,
                "width": 500,
                "maxlength": 20
            },
            {
                "title":"",
                "field":"autoCreate",
                "type":"switch",
                "value": 0,
                "colSize": 4,
                "onChange": (val, option) => {
                    if (val) {
                        option.data.PlanNo = 'TT' + Math.floor(Math.random() * 900 + 100);
                    } else {
                        option.data.PlanNo = '';
                        // 强制更新表单
                        option.form && option.form.$refs.form && option.form.$refs.form.validate(false);
                    }
                },
                "extra": {
                    "style": "margin-left: 5px;display: inline-flex;align-items: center;"
                }
            }
        ],
        [{"title":"方案名称","required":true,"field":"PlanName","type":"text"}],
        [{"dataKey":"业务类型","data":[],"title":"业务类型","field":"BusinessType","colSize":8,"type":"checkbox"},
         {"dataKey":"enable","data":[],"title":"是否启用","field":"IsEnabled","colSize":4,"type":"radio"}],
        [{"title":"备注","field":"Remarks","colSize":12,"type":"textarea"}]
    ];
    const searchFormFields = {"PlanNo":"","PlanName":""};
    const searchFormOptions = [[{"title":"方案编号","field":"PlanNo","type":"like"},{"title":"方案名称","field":"PlanName","type":"like"}]];
    const columns = [{field:'Id',title:'主键',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'PlanNo',title:'方案编号',type:'string',width:110,require:true,align:'left'},
                       {field:'PlanName',title:'方案名称',type:'string',width:110,require:true,align:'left'},
                       {field:'BusinessType',title:'业务类型',type:'string',bind:{ key:'业务类型',data:[]},width:110,align:'left'},
                       {field:'IsEnabled',title:'是否启用',type:'int',bind:{ key:'enable',data:[]},width:110,align:'left'},
                       {field:'Remarks',title:'备注',type:'string',width:110,align:'left'}];
    const detail ={columns:[]};
    const details = [];

    return {
        table,
        key,
        tableName,
        tableCNName,
        newTabEdit,
        editFormFields,
        editFormOptions,
        searchFormFields,
        searchFormOptions,
        columns,
        detail,
        details
    };
}